/*HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH
 H       process.h
 H       Application name: Program Control Block Header File
 H       Programmers names: Thach Nguyen
 H       Date completed:
 H       Brief Description: This is the header file that defines an ADT for any given process.
 H
 HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH*/

 #include "process.h"
 #include <stdlib.h>

// Initializes a process with the given parameters.
 Process process_init(int the_type, int the_number_of_steps, int the_number_of_requests,
                     int *the_array_of_requests, int the_priority)
{
    Process temp = (Process) malloc(sizeof(ProcessStr));
    temp->type = the_type;
    temp->no_steps = the_number_of_steps;
    temp->no_requests = the_number_of_requests;
    temp->requests = the_array_of_requests;
    temp->priority = the_priority;

    return temp;
}

// Frees up the memory used by the process.
void process_destroy(Process the_process)
{
    if (the_process != NULL)
    {
        free(the_process);
        the_process = NULL;
    }
}
